<template>
	<view class="yp" :class="{'theme--Black':CurrentTheme.name==='DarkMode'}">
		<app-headers></app-headers>
		<new-box :list='arr'></new-box>
	</view>
</template>

<script>
	import newBox from './components/newBox.vue'
	export default {
		components: {
			newBox
		},
		data() {
			return {
				arr: []
			}
		},
		onLoad() {
			this.arr = this.$pub.getStorageSync(`chatHistroy_${this.$pub.getStorageSync('UserInfo')._id}`)
			if (this.arr) {
				this.arr = this.$pub.getStorageSync(`chatHistroy_${this.$pub.getStorageSync('UserInfo')._id}`).sort((a, b) =>
					new Date(b.UpdateTime).getTime() - new Date(a.UpdateTime).getTime()
				)
			}

		},
		onShow() {
			// #ifdef APP-PLUS
			//设置导航栏前景色
			this.$nextTick(()=>plus.navigator.setStatusBarStyle(this.CurrentTheme.name==='DarkMode'?'light':"dark"))
			// #endif
			this.arr = this.$pub.getStorageSync(`chatHistroy_${this.$pub.getStorageSync('UserInfo')._id}`)
			if (this.arr) {
				this.arr = this.$pub.getStorageSync(`chatHistroy_${this.$pub.getStorageSync('UserInfo')._id}`).sort((a, b) =>
					new Date(b.UpdateTime).getTime() - new Date(a.UpdateTime).getTime()
				)
			}
		}
	}
</script>

<style scoped lang="less">
	.yp{
		/* #ifdef H5 */
		height: calc(100vh - 50px);
		/* #endif */
		/* #ifdef APP-PLUS */
		height: 100vh;
		/* #endif */
		overflow: scroll;
	}
	.theme--Black{
		/deep/ .cu-list.menu-avatar>.cu-item{
			background-color: #000000;
			color: #fff;
		}
		/deep/ .bg-white{
			background-color: #000000;
			color: #fff;
		}
	}
	
</style>
